package exercise.day05;

import java.util.Scanner;

public class Addition {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int score = 0;
        for (int i = 1; i <= 10; i++) {
            int a = (int) (Math.random() * 100+1);
            int b = (int) (Math.random() * 100+1);
            System.out.println(a + "+" + b + "=?");
            int answer = scan.nextInt();
            if(a+b==answer){
                System.out.println("答对了");
                score+=10;
            }else{
                System.out.println("答错了");
            }
        }
        System.out.println("总分："+score);


        //随机出10个题目并回答，答对了加10分
        //题目 答案 判断对错  分数
        int score1 = 0;
        for (int i = 0; i <= 10; i++) {
            int a = (int) (Math.random() * 50 + 1);
            int b = (int) (Math.random() * 50 + 1);

            System.out.println(a + "+" + b + "=?");

            int answer1 = scan.nextInt();
            if (answer1 == a + b) {
                System.out.println("答对了");
                score1 += 10;
            } else {
                System.out.println("答错了");
            }
        }

        System.out.println("总分：" + score1);
    }
}
